package com.gosophia.conference.action.common;

import java.util.Collections;
import java.util.List;

import net.sf.json.JSONArray;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.gosophia.commons.web.action.BaseSupportAction;
import com.gosophia.conferenceManagement.common.ws.ConferenceHandlerListWebService;
import com.gosophia.conferenceManagement.common.ws.impl.ConferenceHandlerListWebServiceImpl;
import com.gosophia.dataDictionary.dto.DataValueDTO;
import com.gosophia.dataDictionary.ws.DataDictionaryWebService;

@SuppressWarnings("serial")
@Scope("prototype")
@Controller("EnterConferenceHandlerListAction")
public class EnterConferenceHandlerListAction extends BaseSupportAction{

	private String importanceString ;
	
	private String jobTypesString;
	
	private static final Long IMPORTANCE_ENTRYID = 1014L;
	
	@Autowired
    private DataDictionaryWebService dataDictionaryWebService;
	
	@Autowired
	private ConferenceHandlerListWebServiceImpl conferenceHandlerListWebService;
	
	@Override
    public String _execute() throws Exception {
		//获取重要程度列表
        List<DataValueDTO> importanceList = dataDictionaryWebService.findEnabledDataValueByEntryId(IMPORTANCE_ENTRYID);
        if(importanceList!=null){
            Collections.reverse(importanceList);
            setImportanceString(JSONArray.fromObject(importanceList).toString().replace("\"", "\\\""));
        }
        String[] jobTypeArray = conferenceHandlerListWebService.conferenceHandlerListJobTypes;
        this.setJobTypesString(JSONArray.fromObject(jobTypeArray).toString().replace("\"", "\\\""));
        return SUCCESS;
    }

	public void setImportanceString(String importanceString) {
		this.importanceString = importanceString;
	}

	public String getImportanceString() {
		return importanceString;
	}

	public String getJobTypesString() {
		return jobTypesString;
	}

	public void setJobTypesString(String jobTypesString) {
		this.jobTypesString = jobTypesString;
	}
	
	

	
}
